package com.xc.content.exception;

import com.xc.content.enums.HttpStatus;
import lombok.Data;


/**
 * @Author: hyacinth
 * @CreateTime: 2025-01-03
 * @Version: 1.0
 */
@Data
public class BaseException extends RuntimeException {

    private int errorCode;  // 错误代码
    private String msg;     // 错误消息
    private Object data;    // 错误数据
    private HttpStatus httpStatus = HttpStatus.BAD_REQUEST;  // HTTP 状态码，默认 400

    public BaseException(int errorCode, String msg) {
        super(msg);
        this.errorCode = errorCode;
        this.msg = msg;
    }

    public BaseException(int errorCode, String msg,Object data) {
        super(msg);
        this.errorCode = errorCode;
        this.msg = msg;
        this.data = data;
    }
}


